<?php

class Db_Tables_BjmProductsExtraTxt extends Zend_Db_Table
{
    protected $_name = 'bjm_products_extra_txt';
	var $product_id;
	var $extra_txt;
	
	function AddRecord()
	{
		$result = FALSE;
		
		if($this->product_id && $this->extra_txt)
		{
			$row = $this->fetchRow("product_id=".intval($this->product_id));
			
			if($row)
			{
				$row->extra_txt = $this->extra_txt;
				$row->save();
			}else{
				$row = $this->createRow();
				$row->product_id = $this->product_id;
				$row->extra_txt = $this->extra_txt;
				$row->save();
			}
			
			$result = TRUE;
		}
		
		return $result;
	}
	
	function GetExtraTxt()
	{
		$result = "";
		
		if($this->product_id)
		{
			$row = $this->fetchRow("product_id=".intval($this->product_id));
			
			if($row)
			{
				$result = $row->extra_txt;
			}
		}
		
		return $result;
	}
}